module.exports = (app) => {
    const mongoose = app.mongoose;
    const Schema = mongoose.Schema;
  
    const SendallcontentSchema = new Schema({
      ownerWxid: { type: String, required: true, index: true }, // 发送微信号
      wxid: { type: String, required: true }, // 接收的wxid
      nick: { type: String, default: "" }, // 接收的昵称
      msgtype:{ type: String }, // 发送类型
      content: { type: String, default: "" },
      jumpUrl: { type: String, default: "" }, // 跳转链接
      jumpPath: { type: String, default: "" }, // 跳转路径
      gh: { type: String, default: "" }, // 小程序
      appid: { type: String, default: "" }, // 应用ID
      path: { type: String, default: "" }, // 发送路径
      filename: { type: String, default: "" }, 
      musicUrl: { type: String, default: "" }, 
      imageUrl: { type: String, default: "" }, 
      triggerTime: { type: Date }, // 触发时间
      status: { type: Number, default: 0 }, // 0:未发送, 1:已发送, 2:发送失败
      istask: { type: Boolean, default: false }, // 任务是否激活
    }, {
      timestamps: { createdAt: 'createTime', updatedAt: 'updateTime' }
    });
  
    // 设置索引
    SendallcontentSchema.index({ "ownerWxid": 1 });
    SendallcontentSchema.index({ "status": 1 });
  
    return mongoose.model("Sendallcontent", SendallcontentSchema, "Sendallcontent");
  };